
pkgname=pciutils
pkgver=3.5.6
pkgrel=1
pkgdesc="PCI bus configuration space access library and tools"
arch=('x86_64')
license=('GPL2')
groups=('base')
url="http://mj.ucw.cz/pciutils.html"
optdepends=('sh: required by update-pciids') 
depends=('glibc' 'hwids' 'kmod')
makedepends=('wget')
source=("ftp://atrey.karlin.mff.cuni.cz/pub/linux/pci/${pkgname}-${pkgver}.tar.gz")
md5sums=('63b347d2bb5719b7769c03a1bb72a5b7')

build() {
  cd ${pkgname}-${pkgver}
  
  ./update-pciids.sh
  
  make OPT="${CFLAGS} -fPIC -DPIC" ZLIB=no SHARED=no PREFIX=/usr SHAREDIR=/usr/share/hwdata MANDIR=/usr/share/man all
  cp lib/libpci.a ${srcdir}/
  make clean
  make OPT="${CFLAGS}" ZLIB=no SHARED=yes PREFIX=/usr SHAREDIR=/usr/share/hwdata MANDIR=/usr/share/man all
}

package() {
  cd ${pkgname}-${pkgver}
  make SHARED=yes PREFIX=/usr SHAREDIR=/usr/share/hwdata MANDIR=/usr/share/man DESTDIR=${pkgdir} install install-lib
  
  install -m644 ${srcdir}/libpci.a ${pkgdir}/usr/lib/
  # part of hwids package
  rm -rf $pkgdir/usr/{sbin/update-pciids,share/{man/man8/update-pciids.8.gz,hwdata}}
}
